/**
 * test cgi
 */
#include "cgi.h"

using namespace cppcgi;

int main(int argc, char** argv)
{
    string get = "";
    string post = "";
    PropToJson($_GET, get);
    PropToJson($_POST, post);
    string str = "{\"get\":" + get + ", \"post\":" + post + "}";
    string callback = $_GET["callback"];

    if (callback != "")
    {
        Head("text/javascript");
        cout << callback << "(" << str << ");" << endl;
    }
    else
    {
        Head("application/json");
        cout << str << endl;
    }
    return 0;
}
